package com.csp.web;

import com.csp.domain.TUsers;
import com.csp.service.TUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description
 * @Author 杨希栋
 * @Date 2017/6/12 11:22
 */
@Controller
@RequestMapping("/")
public class test {

    @Autowired
    TUsersService tUsersService;

    @RequestMapping("/inLogin")
    public String inLogin(){
        return "login";
    }

    /**
     * 1,登录验证
     * @param request
     * @param tUsers
     * @return
     */
    @RequestMapping(value = "/loginSign",method = {RequestMethod.POST,RequestMethod.GET})
    public String loginSign(HttpServletRequest request, TUsers tUsers){
        String result = "login";
        try {
            if (tUsers == null){
                return result;
            }
            TUsers tUsers1 = tUsersService.get(tUsers);
            if (tUsers1 != null){
                result = "main";
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return result;
    }

    @RequestMapping("/inMain")
    public String main(){
        return "main";
    }

    @RequestMapping("/inMain1")
    public String mainBusinessClient(){
        return "main_business_client";
    }

    @RequestMapping("/inMain2")
    public String mainDaoHang(){
        return "main_daohang";
    }

    @RequestMapping("/inMain3")
    public String mainClientManager(){
        return "main_client_manager";
    }
}
